﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Net.Mail;
/// <summary>
/// Summary description for GuiMail
/// </summary>
public class GuiMail
{
	public GuiMail()
	{
		//
		// TODO: Add constructor logic here
		//
	}
    public static void SendMail(string Mail,string Subject, string Body)
    {
        MailMessage mail = new MailMessage();
        //mail.To.Add(txtTo.Text);
        mail.To.Add(Mail);
        //mail.From = new MailAddress(txtFrom.Text);
        mail.From = new MailAddress("vuliemtk72@gmail.com");
        //mail.Subject = txtSubject.Text;
        mail.Subject =Subject;
        //mail.Body = txtMessage.Text;
        mail.Body = Body;
        mail.IsBodyHtml = true;
        //Attach file using FileUpload Control and put the file in memory stream
        //if (FileUpload1.HasFile)
        // {
        //      mail.Attachments.Add(new Attachment(FileUpload1.PostedFile.InputStream, FileUpload1.FileName));
        //  }
        SmtpClient smtp = new SmtpClient();
        smtp.Host = "smtp.gmail.com"; //Or Your SMTP Server Address
        smtp.Credentials = new System.Net.NetworkCredential
             ("vuliemtk72@gmail.com", "jackjchan@123");
        //Or your Smtp Email ID and Password
        smtp.EnableSsl = true;
        smtp.Send(mail);
    }
}